#include "core/main.h"

FeatureTransform::FeatureTransform(int gridScale, const NeighborhoodFeatureSet& featureSet)
{
    _gridScale = gridScale;
    _featureSet = featureSet; // This might be expensive to copy, but we'll do it anyway
}

void FeatureTransform::transform(const Frame &frame, vector<double> &out) const
{
    FrameGrid grid(frame, _gridScale);
    _featureSet.encodeFrame(grid, out);
}

OutputDataStream & operator<< (OutputDataStream &os, const FeatureTransform &transform)
{
    os << transform._gridScale;
    os << transform._featureSet;
    return os;
}

InputDataStream & operator>> (InputDataStream &is, FeatureTransform &transform)
{
    is >> transform._gridScale;
    is >> transform._featureSet;
    return is;
}